I want to get the network-name (domain-name) on my Mac-Machine. Where iin the Settings does this domain name gets configured. I refer to this page which talks about computer name and host name, I could find where my hostname is present (Settings->General->Sharing->local host name) but not anything related to the network-name (local -domain) .
Even try to fetch this info using the linux api to getdomainname, api call succeeded but it returns Nothing.
#include <iostream>
#include <unistd.h>
#include <limits.h>
#include <cstring>
int main() {
char domainname[255];
// Get the domain name
if (getdomainname(domainname, 255) != 0) {
std::cout << "Error getting domain name" << std::endl;
return 1;
}
std::cout << "Domain name: " << domainname << std::endl;
return 0;
}
Output
Domain name:
I even came across Search-Domains, Does it have anything to do with the network-name (domain name of the machine)?